<template>
	<view class="page-container">
		<view class="article-title">{{articleInfo.title}}</view>
		<view class="article-extra">
			<text>{{articleInfo.createdAt}}</text>
			<text>来源：{{articleInfo.source}}</text>
		</view>
		<rich-text :nodes="articleInfo.content"></rich-text>
	</view>
</template>

<script>
import { getNews } from '../../common/js/api/news'
	export default {
		data() {
			return {
				articleInfo:{}
			}
		},
		onLoad(options) {
			getNews(options.id).then(res=>{
				res.data.content = res.data.content.replace("img src='./","img src='https://www.gov.cn/yaowen/liebiao/202405/")
				res.data.content = res.data.content.replace("<img","<img style='max-width:100%;'")
				res.data.content = res.data.content.replace("style=''","")
				this.articleInfo = res.data
				uni.setNavigationBarTitle({
					title:res.data.title
				})
			})
		}
	}
</script>

<style scoped>
.page-container{
	padding: 16px;
	padding-bottom: 100px;
}

.article-title{
	line-height: 2;
	font-size: 1.2em;	
	text-align: center;
}
.article-extra{
	display: flex;
	justify-content: space-around;
	font-size: .9em;
	text-align: center;
	line-height: 3;
	border-bottom: 1px solid #ccc;
	margin-bottom: 10px;
}
</style>
